package com.tj.jinzao.widgets;


import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.tj.jinzao.R;


/**
 * 选择人物
 * Created by wjy on 2019/1/6.s
 */
public class ChooseLiveUserDialog extends Dialog  {
    private EditText passWord;
    private TextView exit;
    private TextView config,btn_self;
    private Context mContext;
    private String content;
    private boolean type;

    public ChooseLiveUserDialog(Context context,String content,boolean type) {
        super(context);
        this.mContext=context;
        this.content=content;
        this.type=type;
    }

    public ChooseLiveUserDialog(Context context, int theme) {
        super(context, theme);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_choose_live_user);
        passWord=findViewById(R.id.passWord);
        exit=findViewById(R.id.exit);
        config=findViewById(R.id.config);
        btn_self=findViewById(R.id.btn_self);
        if(content==null||content.equals("")){
            content="xx";
        }
        if(content!=null&&!content.equals("")&&(content.equals("请确认是否关闭直播")||content.equals("请确认是否退出直播间"))){
            btn_self.setText(content);
        }else {
            btn_self.setText("请确认是否与"+content+"进行连麦");
            if(type==true){
                btn_self.setText("请确认是否与"+content+"断开连麦");
            }
        }

        config.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(onClickLinstener!=null){
                    onClickLinstener.onConfig();
                }

            }
        });
        exit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(onClickLinstener!=null){
                    onClickLinstener.onExit();
                }

            }
        });
    }

    private String mContent;
    private OnClickLinstener onClickLinstener;
    public interface OnClickLinstener{
        void onConfig();
        void onExit();
    }
    public void setOnClickLinstener(OnClickLinstener onClickLinstener){
        this.onClickLinstener=onClickLinstener;
    }



    public String getContent() {
        return mContent;
    }
}
